from concurrent.futures import ThreadPoolExecutor
import os,sys,time

if __name__ == '__main__':
    # base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    # sys.path.append(base_dir)
    os.environ.setdefault("DJANGO_SETTINGS_MODULE",'untitled2.settings')
    import django
    django.setup()
    def test():
        time.sleep(5)
        print('hello')
    from backend import models
    pool=ThreadPoolExecutor()
    for i in range(5):
        pool.submit(test,)

    # namelist=['fff','ccc','aaa','bbbb']
    # querylist=[]
    # for i in namelist:
    #     querylist.append(models.Remote_User(username=i,password='123qaz!!'))
    # models.Remote_User.objects.bulk_create(querylist)
